package ${packageName}.controller;


import ${packageName}.domain.po.${poName};
import ${packageName}.service.${poName}Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import org.springframework.stereotype.Service;

/**
 * @author honglei
 * @version 1.0
 * @time: ${dateTime}
 * @Description 服务实现层 ${comments}
 */
@RestController
@RequestMapping("/api/${poName}")
public class ${poName}Controller {

    @Autowired
    ${poName}Service service;





    /***
     * 根据id获取详情
     * @param request
     * @param id
     * @return
     */
    @GetMapping(value = "/get/{id}")
    public Object get(HttpServletRequest request, @PathVariable("id") Long id){
        return service.getById(id);
    }


    /***
     * 普通更新
     * @param bean
     * @return
     */
    @PostMapping(value = "/update")
    public Object update(${poName} bean){
        return service.updateById(bean);
    }


    /**
     * 新增
     * @param bean
     * @return
     */
    @PostMapping(value = "/insert")
    public Object insert(${poName} bean){
        return service.save(bean);
    }

 /***
     * 删除
     * @param request
     * @param id
     * @return
     */
    @PostMapping(value = "/del/{id}")
    public Object del(HttpServletRequest request, @PathVariable("id") Long id){
        return service.removeById(id);
    }



    }
